# 构造方法的名称：__init__
"""
class Student:

    def __init__(self, name, age, tel):
        self.name = name
        self.age = age
        self.tel = tel
        print("Student类创建了一个类对象")


stu = Student("zhoujiekun", age="31", tel="18500006666")

print(f"我的名字是{stu.name},我的年龄是{stu.age},我的电话号码是：{stu.tel}")
"""
"""
# homework
class Student:
    def __init__(self,name,age,add):
        self.name = name
        self.age = age
        self.add = add
print("欢迎您进入学生信息录入系统！")
num = int(input("请问你要录入的学生数："))
stu_dict = {}
error_num = 1
name_list = []
for i in range(num):
    print(f"当前录入第{i+1}位学生信息，总共需录入{num}位学生信息")
    name_input = input("请输入学生姓名：")
    age_input = input("请输入学生年龄：")
    add_input = input("请输入学生地址：")
    personal_list = []
    personal_list.append(age_input)
    personal_list.append(add_input)
    personal_list.append(i+1)
    stu = Student(name_input,age_input,add_input)
    if name_input in name_list:
        print(f"{name_input}有重复，已自动添加序号{error_num}")
        name_input = name_input + str(error_num)
        error_num = error_num + 1
        print(f"录入名称为{name_input}")
    name_list.append(name_input)
    stu_dict[name_input] = personal_list
    print(f"学生{i+1}信息录入完成，信息位：【学生姓名：{stu.name}，年龄：{stu.age}，地址：{stu.add}，学号为{i+1}")
    print(stu_dict)
print(stu_dict)
"""
class Student:
    def __init__(self,name,age,add):
        self.name = name
        self.age = age
        self.add = add
print("欢迎您进入学生信息录入系统！")
num = int(input("请问你要录入的学生数："))
stu_dict = {}
name_dict = {}
for i in range(num):
    print(f"当前录入第{i+1}位学生信息，总共需录入{num}位学生信息")
    name_input = input("请输入学生姓名：")
    age_input = input("请输入学生年龄：")
    add_input = input("请输入学生地址：")
    personal_list = []
    personal_list.append(age_input)
    personal_list.append(add_input)
    personal_list.append(i+1)
    stu = Student(name_input,age_input,add_input)
    if name_input in name_dict.keys():
        name_dict[name_input] += 1
        print(f"{name_input}有重复，已自动添加序号{name_dict[name_input]}")
        name_input = name_input + str(name_dict[name_input])
        print(f"录入名称为{name_input}")
    else:
        name_dict[name_input] = 1
    stu_dict[name_input] = personal_list
    print(f"学生{i+1}信息录入完成，信息位：【学生姓名：{stu.name}，年龄：{stu.age}，地址：{stu.add}，学号为{i+1}")
    print(stu_dict)
print(stu_dict)

print(f"你一共录入{num}个学生，以下为他们的具体信息")
for key in stu_dict:
    print(f"姓名：{key}\t年龄：{stu_dict[key][0]}\t地址：{stu_dict[key][1]}\t学号：{stu_dict[key][2]}")
print("输出完毕")